package com.wbp.cms.qatest.dao;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;

import com.wbp.cms.client.product.domain.ProductProfitDO;
import com.wbp.cms.client.product.query.ProductProfitQuery;
import com.wbp.cms.core.product.dao.ProductProfitDAO;
import com.wbp.cms.qatest.BaseTest;


/**
 * @Description: 
 * @Department:
 * @author andy.lhc
 * @date 2016年3月10日 下午8:29:25 
 */
public class ProductProfitDAOTest extends BaseTest {

   @Resource
   private  ProductProfitDAO  productProfitDAO ;
   @Test
   public void  test_新增001(){
   
     ProductProfitDO productProfitDO =new ProductProfitDO();
     productProfitDO.setComments("test");
     productProfitDO.setProductId(2L);
     productProfitDO.setMinAmount(100);
     productProfitDO.setMaxAmount(300); 
     BigDecimal  decimal = new BigDecimal("0.4") ;
     productProfitDO.setRatio(decimal);
     System.out.println( productProfitDAO.insert(productProfitDO) > 0 )  ;
     
   }
   
   @Test
   public void test_查询(){
     
     ProductProfitDO pp = this.productProfitDAO.load(2L) ;
     System.out.println(pp);
   }
   
   @Test
   public void test_更新(){
     ProductProfitDO pp = this.productProfitDAO.load(1L) ;
     pp.setMinAmount(100);
     pp.setMaxAmount(300); 
     pp.setRatio(new BigDecimal(5.6d));
     System.out.println( this.productProfitDAO.update(pp) >0 ) ;
   }
   
   @Test
   public void test_delete(){
     
     System.out.println( this.productProfitDAO.delete(3L) > 0  ) ;
     
   }
   
   @Test
   public void test_query(){
     ProductProfitQuery productProfitQuery =new ProductProfitQuery();
    // productProfitQuery.setId(1L);
     productProfitQuery.setProductId(2L);
     List<ProductProfitDO> list = this.productProfitDAO.query(productProfitQuery) ;
     System.out.println("size:"+list.size());
     
     
   }
   
}
